package com.tkxs.global.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tkxs.global.exception.MyException;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
public class ExceptionTestController {
	
	
	@GetMapping("/testGlobalException")
	public String testException() {
		log.info("线程=={}==testException方法执行",Thread.currentThread().getName());
		// 在这里造一个空指针异常
		int a = 10/0;
		return "success";
	}
	
	@GetMapping("/testMyException")
	public String testMyException() {
		log.info("线程=={}==testMyException方法执行",Thread.currentThread().getName());
		// 在这里抛出一个自己定义的异常
		throw new MyException();
		 //return "success";
	}

}
